<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>Demo</title>
    <link rel="stylesheet" th:href="@{'/webjars/bootstrap/4.1.3/css/bootstrap.css'}">
    <link rel="stylesheet" th:href="@{'/css/styles.css'}">
</head>
<body>
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-primary">
    <a class="navbar-brand" href="#">Demo</a>
    <button class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
            aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
    </button>
</nav>
<div class="container">
    <form method="post" th:action="@{/messages}" role="form">
        <div class="form-group">
            <div class="col-sm-10">
                <textarea class="form-control" name="text" cols="50" rows="3" placeholder="Enter message"></textarea>
            </div>
        </div>

        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-4">
                <input type="submit" class="btn btn-primary pull-right" value="Submit"/>
                <div class="clearfix"></div>
            </div>
        </div>
    </form>

    <div>
        <table class="table">
            <thead>
            <tr>
                <th scope="col">Message</th>
                <th scope="col">Date</th>
            </tr>
            </thead>
            <tbody>
            <tr th:each="msg : ${messages}">
                <td th:text="${msg.text}">text</td>
                <td th:text="${msg.createdOn}">date</td>
            </tr>
            </tbody>
        </table>
    </div>
</div>
</body>
</html>